home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gekikoh Dennoh Club 1
/
Gekikoh Dennoh Club Vol. 1 (Japan).7z
/
Gekikoh Dennoh Club Vol. 1 (Japan) (Track 1).bin
/
kowin
/
archive
/
apl
/
gview120.lzh
/
gviewsrc.lzh
/
xpi_load.s
< prev
next >
Wrap
Text File
|
1995-02-12
|
26KB
|
1,452 lines
*****************************************************************************************
* Pi X68K 16色圧縮 *
* Ver 1.05 *
* Loader Module. *
* Copyright (c) 1990,91 やなぎさわ *
*****************************************************************************************
* Ko-Window KoPI.win 用にちょっとだけ書き換えました
* KoPI を 1 にすると完全に元に戻ります。
* 1991 1/22 小笠原博之 SPS-NET: SPS0783 COR.
KoPI equ 0 * KoPI モードスイッチ
*
_OPEN EQU $ff3d
_CLOSE EQU $ff3e
_READ EQU $ff3f
_SUPER EQU $ff20
.xdef _PiLoad
.xdef _Pi_PaletteBuff
* .xdef _ToneSet
*////////////////////////////////////////////////////////////////////////////////////////
* int PiLoad( file, buff, Size, X, Y, Xwid, Ywid , tone, opt)
*
* 引数
* char *file ファイル名
* short *buff バッファのポインタ (展開およびファイルバッファ)
* int Size バッファのサイズ
* int X 表示アドレスのX座標
* int Y 表示アドレスのY座標
* int Xwid X方向の展開サイズ(負数で省略)
* int Ywid Y方向の展開サイズ(負数で省略)
* int tone とーん(1~100%)
* int opt おぷしょん (下記のビットで指定)
* (lsb)0 .. パレット設定 する/しない = 1/0
* 1 .. 画面展開 する/しない = 1/0
* 2 .. コメント表示 する/しない = 1/0
* 3 .. 画面設定 する/しない = 1/0
* (すでに設定ずみの場合は設定しない)
*
* 戻り値
* 0 正常終了
* -8 バッファが足りない
* -35 サイズ指定が変
* -31 パイでは無い
* -32 サポートされていない
* 他負数 ファイルエラー(HumanのDOSコールエラー参照)
*
* ・Cからそのまま呼び出せます。
* ・描画データはバッファアドレス+2048よりデータが格納されます。
* (1バイト/1ドット)
* ・パレットはグローバルシンボルの"_PaletteBuff"より格納されます。
* ・呼び出しはユーザ/スーパバイザどちらの状態からでも大丈夫です。
* ・.r 化が可能です。
* ・バッファサイズは X_SIZE*Y_SIZE+2048+3+128 以上必要です。(うぅでかい)
* (SIZEは表示サイズではなくて、実際のデータのサイズ)
* ・展開サイズは指定したサイズに拡大および縮小されて表示されます。
* 省略した場合のサイズは適当に設定されます。
* ・自己書き換えをしているので注意
*
_PiLoad
move.l sp,a1
movem.l d3-d7/a3-a6,-(sp)
lea data(pc),a6
move.w sr,d0
and.w #$2000,d0 今がスーパかどうかの判断
beq piloada
bsr PiLoad
bra pi_fin
piloada
clr.l -(sp)
dc.w _SUPER スーパーバイザーセット
move.l d0,(sp)
bsr PiLoad
move.l d0,d1
dc.w _SUPER ユーザー
lea 4(sp),sp
move.l d1,d0
pi_fin
movem.l (sp)+,d3-d7/a3-a6
rts
*
PiLoad
move.l sp,stk(a6) 大域脱出用
move.l 4(a1),file_name(a6)
move.l 8(a1),gbuff(a6)
move.l 12(a1),buff_size(a6)
move.l 16(a1),d0 X
move.l 20(a1),d1 Y
lea $c00000,a0
mulu #2048,d1
add.w d0,d1
add.w d0,d1
add.l d1,a0
move.l a0,addr(a6)
move.l 24(a1),d0 Xwid
move.w d0,xwid(a6)
bmi piload0
add.l 16(a1),d0
cmp.l #1024,d0
bgt size_error
piload0
move.l 28(a1),d0 Ywid
move.w d0,ywid(a6)
bmi piload1
add.l 20(a1),d0
cmp.l #1024,d0
bgt size_error
piload1
move.l a1,-(sp)
move.l 32(a1),d0
move.w d0,tone(a6)
move.l 36(a1),d0
move.w d0,opt(a6)
move.w #0,-(sp) for read
move.l file_name(a6),-(sp)
.dc.w _OPEN
addq.l #6,sp
move.w d0,file(a6)
bmi file_error
bsr color_initialize
bsr header_read
move.l (sp)+,a1
move.w xwid(a6),d0 再チェック
add.w 18(a1),d0
cmp.w #1024,d0
bgt size_error
move.w ywid(a6),d0
add.w 22(a1),d0
cmp.w #1024,d0
bgt size_error
move.w colum(a6),d0
lea rewrite_table(pc),a0
piload2
move.w (a0)+,d2
beq piload3
move.w (a0)+,d1
add.w d0,d1
neg.w d1
move.w d1,2(a6,d2.w)
bra piload2
piload3
add.w d0,d0
neg.w d0
move.w d0,pat6-data+2(a6)
move.w d0,pat15-data+2(a6)
move.w colum(a6),d0
and.w #1,d0
beq piload_even
move.b #OPload_len-patp0-2,patp0-data+3(a6)
move.b #OPload_lenx-patp1-2,patp1-data+3(a6)
bra piload4
piload_even
move.b #Pload_len-patp0-2,patp0-data+3(a6)
move.b #Pload_lenx-patp1-2,patp1-data+3(a6)
piload4
bsr read_ready
bsr expand
.if KoPI
btst.b #3,opt+1(a6)
beq piload5
bsr set_crt
.endif
piload5
.if KoPI
btst.b #2,opt+1(a6)
beq piload8
bsr com_disp *コメントの表示
.endif
piload8
.if KoPI
btst.b #0,opt+1(a6)
beq piload6
bsr set_pal *パレットをセットする
.endif
piload6
.if KoPI
btst.b #1,opt+1(a6)
beq piload7
bsr trans
.endif
piload7
move.w file(a6),-(sp)
.dc.w _CLOSE
addq.l #2,sp
rts
*---------------------------------------------------------------------------------------*
header_read
bsr getc
cmp.b #'P',d0
bne no_pi
bsr getc
cmp.b #'i',d0
bne no_pi
comment:
bsr getc
cmp.b #26,d0
bne comment
com0
bsr getc
tst.b d0
bne com0
bsr getc
cmp.b #0,d0
bne no_support
bsr getc
move.w d0,ritu0(a6) * 比率
bsr getc
move.w d0,ritu1(a6)
bsr getc
cmp.b #4,d0
bne no_pi
bsr getw
bsr getw * 機種
bsr getw * 機種ユニーク
subq.w #1,d0
bmi head_read1
move.w d0,d1
head_read2
bsr getc * 機種予約
dbra d1,head_read2
head_read1
bsr getw * X width
move.w d0,colum(a6)
bsr getw
move.w d0,line(a6) * Y width
mulu colum(a6),d0
addq.l #1,d0
and.w #$fffe,d0
add.l #2048+2,d0
move.l gbuff(a6),a0
add.l d0,a0
move.l buff_size(a6),d1
sub.l d0,d1
move.l d1,d0
bsr buffer_set
tst.w xwid(a6)
bpl head_read5
tst.w ywid(a6)
bpl head_read7
move.w colum(a6),xwid(a6)
bra head_read5
head_read7
move.w colum(a6),d0
mulu ywid(a6),d0
divu line(a6),d0
move.w d0,xwid(a6)
move.w ritu0(a6),d0
beq head_read5
move.w ritu1(a6),d1
beq head_read5
move.w xwid(a6),d2
mulu d1,d2
divu d0,d2
move.w d2,xwid(a6)
head_read5
tst.w ywid(a6)
bpl head_read4
tst.w xwid(a6)
bpl head_read6
move.w line(a6),ywid(a6)
bra head_read8
head_read6
move.w line(a6),d0
mulu xwid(a6),d0
divu colum(a6),d0
move.w d0,ywid(a6)
head_read8
move.w ritu0(a6),d0
beq head_read4
move.w ritu1(a6),d1
beq head_read4
move.w ywid(a6),d2
mulu d0,d2
divu d1,d2
move.w d2,ywid(a6)
head_read4
lea palette(a6),a4
move.w #3*16-1,d1
head_read0
bsr getc
move.b d0,(a4)+
dbra d1,head_read0
rts
*---------------------------------------------------------------------------------------*
* GVRAMへ転送
*---------------------------------------------------------------------------------------*
.if KoPI
trans
move.l addr(a6),a0
move.l gbuff(a6),a1
lea 2048(a1),a1
move.w line(a6),d0
cmp.w ywid(a6),d0
bge transsmall
* 拡大
move.w ywid(a6),d0
move.w d0,d1
subq.l #1,d1
transbig_lop
sub.w line(a6),d0
bmi transb0
bsr trans_line
dbra d1,transbig_lop
bra trans_end
transb0
add.w ywid(a6),d0
add.w colum(a6),a1
bsr trans_line
dbra d1,transbig_lop
bra trans_end
**
transsmall
move.w ywid(a6),d1
subq.l #1,d1
clr.w d0
transsmall_lop
sub.w ywid(a6),d0
bmi transs0
add.w colum(a6),a1
bra transsmall_lop
transs0
add.w line(a6),d0
bsr trans_line
add.w colum(a6),a1
dbra d1,transsmall_lop
trans_end
rts
trans_line
move.l a0,a3
lea 2048(a0),a0
move.l a1,a2
moveq.l #0,d5
move.w colum(a6),d3
cmp.w xwid(a6),d3
beq trans_line_eq
bgt trans_line_small
* 拡大
move.w xwid(a6),d3
move.w d3,d4
subq.l #1,d4
trans_lb_lop
sub.w colum(a6),d3
bmi translb0
move.b (a2),d5
move.w d5,(a3)+
dbra d4,trans_lb_lop
rts
translb0
add.w xwid(a6),d3
addq.l #1,a2
move.b (a2),d5
move.w d5,(a3)+
dbra d4,trans_lb_lop
rts
**
trans_line_small
move.w xwid(a6),d4
subq.l #1,d4
clr.w d3
trans_ls_lop
sub.w xwid(a6),d3
bmi transls0
addq.l #1,a2
bra trans_ls_lop
transls0
add.w colum(a6),d3
move.b (a2),d5
move.w d5,(a3)+
addq.l #1,a2
dbra d4,trans_ls_lop
rts
**
trans_line_eq
move.w colum(a6),d3
move.l a2,d4
and.w #1,d4
bne trans_line_eq02
and.w #$fff0,d3
lsr.w #4,d3
beq trans_line_eq0
subq.l #1,d3
trans_line_eql
movem.l (a2)+,d4/d5/d6/d7
movep.l d4,1(a3)
movep.l d5,9(a3)
movep.l d6,17(a3)
movep.l d7,25(a3)
lea 32(a3),a3
dbra d3,trans_line_eql
trans_line_eq0
moveq.l #0,d5
move.w colum(a6),d3
and.w #15,d3
beq trans_line_eqe
trans_line_eq02
subq.l #1,d3
trans_line_eq0l
move.b (a2)+,d5
move.w d5,(a3)+
dbra d3,trans_line_eq0l
trans_line_eqe
rts
.endif
*---------------------------------------------------------------------------------------*
set_crt
.if KoPI
move.w #-1,-(sp)
move.w #16,-(sp)
dc.w $ff23
addq.l #4,sp
cmp.w #1,d0 モードチェック
bne set_crt0
move.w $e80028,d0 うそチェック
and.w #$700,d0
cmp.w #$400,d0
beq set_crt1
set_crt0
move.w #1,-(sp)
move.w #16,-(sp)
.dc.w $ff23 conctrl 768*512.16color
addq.l #4,sp
set_crt1
rts
.endif
*---------------------------------------------------------------------------------------*
.if 0
.if KoPI.eq.0
.xdef _SetPal
_SetPal:
movem.l d0-d7/a0-a6,-(sp)
lea data(pc),a6
clr.l -(sp)
.dc.w $ff20
move.l d0,(sp)
.endif
set_pal
lea palette(a6),a0
lea $e82000,a1
move.w #16-1,d4
set_pal_lop
moveq.l #0,d1
move.b (a0)+,d1
mulu tone(a6),d1
divu #100,d1
moveq.l #0,d0
move.b (a0)+,d0
mulu tone(a6),d0
divu #100,d0
moveq.l #0,d2
move.b (a0)+,d2
mulu tone(a6),d2
divu #100,d2
lsl.w #8,d0
and.w #$f800,d0
lsl.w #3,d1
and.w #$7c0,d1
lsr.w #2,d2
and.w #$3f,d2
or.w d1,d0
or.w d2,d0
move.w d0,(a1)+
dbra d4,set_pal_lop
.if KoPI.eq.0
.dc.w $ff20
addq.l #4,sp
movem.l (sp)+,d0-d7/a0-a6
.endif
rts
.endif
*---------------------------------------------------------------------------------------*
com_disp
.if KoPI
clr.w -(sp)
pea 2
move.w file(a6),-(sp)
dc.w $ff42 *seek
addq.l #8,sp
bmi file_error
move.w #2,-(sp)
move.w #10,-(sp)
.dc.w $ff23
move.w #25,-(sp)
clr.w -(sp)
move.w #3,-(sp)
.dc.w $ff23
lea 10(sp),sp
.endif
com_disp_lop
.if KoPI
bsr getc
cmp.b #26,d0
beq com_disp_end
move.w d0,-(sp)
.dc.w $ff02 putchar
addq.l #2,sp
bra com_disp_lop
.endif
com_disp_end
rts
*---------------------------------------------------------------------------------------*
expand_one
move.l gbuff(a6),a2
lea 2048(a2),a2
move.w line(a6),d4
mulu colum(a6),d4
add.l a2,d4
clr.w d0
expand_one_lop
lea ret_one(pc),a4
bra read_color
ret_one
move.b d0,(a2)+
cmp.l d4,a2
blt expand_one_lop
rts
*---------------------------------------------------------------------------------------*
expand:
cmp.w #2,colum(a6)
ble expand_one
move.l gbuff(a6),a2
clr.w d0
lea ret0(pc),a4
bra read_color
ret0
move.w d0,d1
lea ret1(pc),a4
bra read_color
ret1
move.w #1024-1,d2 * 1024 fixed
expand0
move.b d1,(a2)+
move.b d0,(a2)+
dbra d2,expand0
move.l a2,d4
move.w line(a6),d5
mulu colum(a6),d5
add.l d5,d4
moveq.l #-1,d5
bra.b expand_lop0
expand_lop
cmpa.l d4,a2
bge expand_end
expand_lop0
sub.w #2,d7
bge expand9
addq.w #1,d7
beq.b expand100
move.w #14,d7
add.l d6,d6
subq.l #2,buff_lest(a6)
bgt.b expand101
bsr buff_read
expand101
move.w (a5)+,d6
add.l d6,d6
move.l d6,d0
swap d0
and.w #3,d0
cmp.w #3,d0
bne expand1
bra expand200
expand100
move.w #15,d7
add.l d6,d6
add.l d6,d6
subq.l #2,buff_lest(a6)
bgt.b expand102
bsr buff_read
expand102
move.w (a5)+,d6
move.l d6,d0
swap d0
and.w #3,d0
cmp.w #3,d0
bne expand1
expand200
** 1 bit load
add.w d6,d6
dbcc d7,ex0
dbcs d7,ex3
bcc.b ex2
moveq.l #15,d7
subq.l #2,buff_lest(a6)
bgt.b ex1
bsr buff_read
ex1
move.w (a5)+,d6
ex0
cmp.w #4,d5
beq exx
moveq.l #4,d5
bra load_length
ex2
moveq.l #15,d7
subq.l #2,buff_lest(a6)
bgt.b ex4
bsr buff_read
ex4
move.w (a5)+,d6
ex3
cmp.w #3,d5
beq exx
moveq.l #3,d5
bra load_length
expand9
rol.w #2,d6
move.w d6,d0
expand10
and.w #3,d0
cmp.w #3,d0
beq expand200
expand1
cmp.w d5,d0
bne expand3
exx
moveq.l #-1,d5
moveq.l #0,d0
lea ret3(pc),a3
move.l a3,d2
lea ret2(pc),a3
expand21
move.b -1(a2),d0
expand20
move.l a3,a4
* bra read_color
lsl.w #5,d0
lea 30(a6,d0.w),a0
add.w d6,d6
dbcc d7,abc0
dbcs d7,read_col0
bcc re0
moveq.l #15,d7
subq.l #2,buff_lest(a6)
bgt.b abc1
bsr buff_read
abc1
move.w (a5)+,d6
abc0
add.w d6,d6
dbcs d7,abc2
dbcc d7,abc5
bcs abc4
moveq.l #15,d7
subq.l #2,buff_lest(a6)
bgt.b abc3
bsr buff_read
abc3
move.w (a5)+,d6
abc2
move.w (a0),d0
jmp (a4)
abc4
moveq.l #15,d7
subq.l #2,buff_lest(a6)
bgt.b abc6
bsr buff_read
abc6
move.w (a5)+,d6
abc5
move.l -2(a0),d0
swap d0
move.l d0,-2(a0)
*--
ret2
move.b d0,(a2)+
move.l d2,a4
* bra read_color
lsl.w #5,d0
lea 30(a6,d0.w),a0
add.w d6,d6
dbcc d7,abc00
dbcs d7,read_col0
bcc re0
moveq.l #15,d7
subq.l #2,buff_lest(a6)
bgt.b abc10
bsr buff_read
abc10
move.w (a5)+,d6
abc00
add.w d6,d6
dbcs d7,abc20
dbcc d7,abc50
bcs abc40
moveq.l #15,d7
subq.l #2,buff_lest(a6)
bgt.b abc30
bsr buff_read
abc30
move.w (a5)+,d6
abc20
move.w (a0),d0
jmp (a4)
abc40
moveq.l #15,d7
subq.l #2,buff_lest(a6)
bgt.b abc60
bsr buff_read
abc60
move.w (a5)+,d6
abc50
move.l -2(a0),d0
swap d0
move.l d0,-2(a0)
ret3
move.b d0,(a2)+
** 1 bit load
add.w d6,d6
dbcc d7,expand20
dbcs d7,expand_lop
bcc.b ex20
moveq.l #15,d7
subq.l #2,buff_lest(a6)
bgt.b ex30
bsr buff_read
ex30
move.w (a5)+,d6
bra expand21
ex20
moveq.l #15,d7
subq.l #2,buff_lest(a6)
bgt.b ex40
bsr buff_read
ex40
move.w (a5)+,d6
bra expand_lop
expand3
move.w d0,d5
*
* 長さをロード
*
load_length
add.w d6,d6
dbcs d7,expandx
dbcc d7,load_len00
bcc load_len01
moveq.l #15,d7
subq.l #2,buff_lest(a6)
bgt.b load_len11
bsr buff_read
load_len11
move.w (a5)+,d6
load_len00
move.l d7,d2
dbra d7,load_len0
load_len3
moveq.l #15,d7
add.w #16,d2
subq.l #2,buff_lest(a6)
bgt.b load_len1
bsr buff_read
load_len1
move.w d6,d0
move.w (a5)+,d6
add.w d0,d0
bcc.b load_len2
subq.l #1,d7
load_len0
add.w d6,d6
dbcc d7,load_len0
bcs.b load_len3
load_len2
moveq.l #1,d3
sub.l d7,d2
load_len4
lsl.l d2,d3
*
load_len5
sub.w d2,d7
bge load_len6
add.w d2,d7
addq.w #1,d7
and.l #$ffff,d6
lsl.l d7,d6
sub.w d7,d2
move.w d2,d7
subq.l #2,buff_lest(a6)
bgt.b load_len8 必要があれば次のバッファ読む
bsr buff_read
load_len8
move.w (a5)+,d6
lsl.l d7,d6
neg.w d7
add.w #15,d7
move.l d6,d2
swap d2
add.w d2,d3
subq.l #1,d3
beq expandx
move.w d5,d0
add.w d0,d0
bra patp0
* jmp Pload_len(pc,d0.w)
load_len6
swap d6
clr.w d6
rol.l d2,d6
add.w d6,d3
swap d6
load_len_end
**
subq.l #1,d3
move.w d5,d0
add.w d0,d0
patp0
jmp Pload_len(pc,d0.w)
OPload_len
bra.b expand_1
bra.b oexpand_2
bra.b expand_3d
bra.b oexpand_4
oexpand_5
pat1
lea -641(a2),a3
oexpand5_lop
move.w (a3)+,(a2)+
dbra d3,oexpand5_lop
sub.l #$10000,d3
bmi expand_lop
bra.b oexpand5_lop
*
oexpand_2
pat2
lea -640(a2),a3
oexpand2_lop
move.b (a3)+,(a2)+
move.b (a3)+,(a2)+
dbra d3,oexpand2_lop
sub.l #$10000,d3
bmi expand_lop
bra.b oexpand2_lop
**
oexpand_4
pat3
lea -639(a2),a3
oexpand4_lop
move.w (a3)+,(a2)+
dbra d3,oexpand4_lop
sub.l #$10000,d3
bmi expand_lop
bra.b oexpand4_lop
*--
Pload_len
bra.b expand_1
bra.b expand_2
bra.b expand_3
bra.b expand_4d
expand_5
pat4
lea -641(a2),a3
expand5_lop
move.b (a3)+,(a2)+
move.b (a3)+,(a2)+
dbra d3,expand5_lop
sub.l #$10000,d3
bmi expand_lop
bra.b expand5_lop
**
expand_3d bra expand_3
expand_4d bra expand_4
**
expand_1
move.w -2(a2),d0
cmp.b -2(a2),d0
bne.b expand11
expand10_lop
move.w d0,(a2)+
dbra d3,expand10_lop
sub.l #$10000,d3
bmi expand_lop
bra.b expand10_lop
expand11
move.w -4(a2),d1
expand11_lop
move.w d1,(a2)+
dbra d3,expand110
sub.l #$10000,d3
bmi expand_lop
expand110
move.w d0,(a2)+
dbra d3,expand11_lop
sub.l #$10000,d3
bmi expand_lop
bra.b expand11_lop
**
expand_2
pat5
lea -640(a2),a3
expand2_lop
move.w (a3)+,(a2)+
dbra d3,expand2_lop
sub.l #$10000,d3
bmi expand_lop
bra.b expand2_lop
**
expand_3
pat6
lea -1280(a2),a3
expand3_lop
move.w (a3)+,(a2)+
dbra d3,expand3_lop
sub.l #$10000,d3
bmi expand_lop
bra.b expand3_lop
**
expand_4
pat7
lea -639(a2),a3
expand4_lop
move.b (a3)+,(a2)+
move.b (a3)+,(a2)+
dbra d3,expand4_lop
sub.l #$10000,d3
bmi expand_lop
bra.b expand4_lop
**
expand_end
rts
*-
load_len01
moveq.l #15,d7
subq.l #2,buff_lest(a6)
bgt.b load_len02
bsr buff_read
load_len02
move.w (a5)+,d6
*-
expandx
move.w d5,d0
add.w d0,d0
patp1
jmp Pload_lenx(pc,d0.w)
OPload_lenx
bra.b expand_1x
bra.b oexpand_2x
bra.b expand_3x
bra.b oexpand_4x
oexpand_5x
pat8
move.w -641(a2),(a2)+
bra expand_lop
oexpand_2x
pat9
move.b -640(a2),(a2)+
pat10
move.b -640(a2),(a2)+
bra expand_lop
oexpand_4x
pat11
move.w -639(a2),(a2)+
bra expand_lop
*--------------
Pload_lenx
bra.b expand_1x
bra.b expand_2x
bra.b expand_3x
bra.b expand_4x
expand_5x
pat12
move.b -641(a2),(a2)+
pat13
move.b -641(a2),(a2)+
bra expand_lop
expand_1x
move.w -2(a2),d0
cmp.b -2(a2),d0
bne.b expand_10x
move.w d0,(a2)+
bra expand_lop
expand_10x
move.w -4(a2),(a2)+
bra expand_lop
expand_2x
pat14
move.w -640(a2),(a2)+
bra expand_lop
expand_3x
pat15
move.w -1280(a2),(a2)+
bra expand_lop
expand_4x
pat16
move.b -639(a2),(a2)+
pat17
move.b -639(a2),(a2)+
bra expand_lop
*---------------------------------------------------------------------------------------*
* カラーテーブルの初期化
*---------------------------------------------------------------------------------------*
color_initialize
move.l a6,a0
moveq.l #1,d1
col_ini0
move.w d1,d0
moveq.l #16-1,d2
col_ini1
and.w #15,d0
move.w d0,(a0)+
addq.l #1,d0
dbra d2,col_ini1
addq.l #1,d1
cmp.w #16,d1
ble col_ini0
rts
*---------------------------------------------------------------------------------------*
read_color
lsl.w #5,d0
lea 30(a6,d0.w),a0
add.w d6,d6
dbcc d7,re2
dbcs d7,read_col0
bcc re0
Xread_col
moveq.l #15,d7
subq.l #2,buff_lest(a6)
bgt.b re21
bsr buff_read
re21
move.w (a5)+,d6
re2
add.w d6,d6
dbcs d7,re40
dbcc d7,read_col3
bcs re41
moveq.l #15,d7
subq.l #2,buff_lest(a6)
bgt.b re42
bsr buff_read
re42
move.w (a5)+,d6
re40
move.w (a0),d0
jmp (a4)
re41
moveq.l #15,d7
subq.l #2,buff_lest(a6)
bgt.b re43
bsr buff_read
re43
move.w (a5)+,d6
read_col3
move.l -2(a0),d0
swap d0
move.l d0,-2(a0)
jmp (a4)
**
re0
moveq.l #15,d7
subq.l #2,buff_lest(a6)
bgt.b re00
bsr buff_read
re00
move.w (a5)+,d6
read_col0
add.w d6,d6
dbcc d7,read_col1
dbcs d7,recx0
bcs recx1
moveq.l #15,d7
subq.l #2,buff_lest(a6)
bgt.b recx3
bsr buff_read
recx3
move.w (a5)+,d6
recx0
add.w d6,d6
dbcc d7,read_col5
dbcs d7,recx4
bcs.b recx5
moveq.l #15,d7
subq.l #2,buff_lest(a6)
bgt.b recx7
bsr buff_read
recx7
move.w (a5)+,d6
recx4
move.w -4(a0),d0
move.l -2(a0),-4(a0)
move.w d0,(a0)
jmp (a4)
recx5
moveq.l #15,d7
subq.l #2,buff_lest(a6)
bgt.b recx6
bsr buff_read
recx6
move.w (a5)+,d6
read_col5
move.w -6(a0),d0
move.l -4(a0),-6(a0)
move.w (a0),-2(a0)
move.w d0,(a0)
jmp (a4)
recx1
moveq.l #15,d7
subq.l #2,buff_lest(a6)
bgt.b recx2
bsr buff_read
recx2
move.w (a5)+,d6
read_col1
add.w d6,d6
dbcc d7,rec0
dbcs d7,rec1
bcc.b rec2
moveq.l #15,d7
subq.l #2,buff_lest(a6)
bgt.b rec3
bsr buff_read
rec3
move.w (a5)+,d6
rec0
subq.w #3,d7
bge.b rec10
addq.w #4,d7
and.l #$ffff,d6
lsl.l d7,d6
subq.w #3,d7
neg.w d7
subq.l #2,buff_lest(a6)
bgt.b rec11
bsr buff_read
rec11
move.w (a5)+,d6
lsl.l d7,d6
neg.w d7
add.w #15,d7
move.l d6,d3
swap d3
and.w #7,d3
bra getcol
rec10
rol.w #3,d6
moveq.l #7,d3
and.w d6,d3
getcol
add.w d3,d3
sub.w d3,a0
lea -16(a0),a0
lea 2(a0),a1
move.w (a0),d0
neg.w d3
jmp getcol1(pc,d3.w)
move.w (a1)+,(a0)+
move.w (a1)+,(a0)+
move.w (a1)+,(a0)+
move.w (a1)+,(a0)+
move.w (a1)+,(a0)+
move.w (a1)+,(a0)+
move.w (a1)+,(a0)+
getcol1
move.l (a1)+,(a0)+
move.l (a1)+,(a0)+
move.l (a1)+,(a0)+
move.l (a1)+,(a0)+
move.w d0,(a0)
jmp (a4)
*-
rec2
moveq.l #15,d7
subq.l #2,buff_lest(a6)
bgt.b rec4
bsr buff_read
rec4
move.w (a5)+,d6
rec1
sub.w #2,d7
bge.b rec8
addq.w #1,d7
beq.b rec5
move.w #14,d7
add.l d6,d6
subq.l #2,buff_lest(a6)
bgt.b rec6
bsr buff_read
rec6
move.w (a5)+,d6
add.l d6,d6
move.l d6,d3
swap d3
bra.b rec9
rec5
move.w #15,d7
add.l d6,d6
add.l d6,d6
subq.l #2,buff_lest(a6)
bgt.b rec7
bsr buff_read
rec7
move.w (a5)+,d6
move.l d6,d3
swap d3
bra.b rec9
rec8
rol.w #2,d6
move.w d6,d3
rec9
and.w #3,d3
add.w d3,d3
sub.w d3,a0
subq.l #8,a0
lea 2(a0),a1
move.w (a0),d0
neg.w d3
jmp getcolB(pc,d3.w)
move.w (a1)+,(a0)+
move.w (a1)+,(a0)+
move.w (a1)+,(a0)+
getcolB
move.l (a1)+,(a0)+
move.l (a1)+,(a0)+
move.w d0,(a0)
jmp (a4)
*---------------------------------------------------------------------------------------*
* ビット読み込み *
* in d0 = bits length *
* out d0 = data *
*---------------------------------------------------------------------------------------*
load_bit
sub.w d0,d7 ビットポイントチェック
blt.b load_bit_a
swap d6
clr.w d6
rol.l d0,d6
move.w d6,d0
swap d6
rts
load_bit_a
add.w d0,d7
addq.w #1,d7
and.l #$ffff,d6
lsl.l d7,d6
sub.w d7,d0
move.w d0,d7
subq.l #2,buff_lest(a6)
bgt.b load_bit0 必要があれば次のバッファ読む
bsr buff_read
load_bit0
move.w (a5)+,d6
lsl.l d7,d6
neg.w d7
add.w #15,d7
move.l d6,d0
swap d0
load_bit_e
rts
*---------------------------------------------------------------------------------------*
* 1ワード読む
*---------------------------------------------------------------------------------------*
getw
bsr getc
lsl.w #8,d0
move.w d0,-(sp)
bsr getc
move.b d0,1(sp)
move.w (sp)+,d0
rts
*---------------------------------------------------------------------------------------*
* 1バイト読む
*---------------------------------------------------------------------------------------*
getc
move.w file(a6),-(sp)
dc.w $ff1b
addq.l #2,sp
tst.l d0
bmi file_error
rts
*---------------------------------------------------------------------------------------*
* バッファ読む
*---------------------------------------------------------------------------------------*
*
buff_read
move.l buff_addr(a6),a5
move.l buff_size(a6),-(sp)
move.l buff_addr(a6),-(sp)
move.w file(a6),-(sp)
dc.w _READ
lea 10(sp),sp
move.l d0,buff_lest(a6)
bmi file_error
rts
*---------------------------------------------------------------------------------------*
* 読み込みのための用意 *
*---------------------------------------------------------------------------------------*
*
read_ready
bsr buff_read
move.w (a5)+,d6
rts
*---------------------------------------------------------------------------------------*
* バッファをセットします。 *
*---------------------------------------------------------------------------------------*
*
* in d0 = buff size
* out a0 = buff address
*
buffer_set
and.l #$ffff_fffe,d0
cmp.l #128,d0
blt buff_error
move.l d0,buff_size(a6)
move.l d0,buff_lest(a6)
move.l a0,buff_addr(a6)
move.l a0,buff_point(a6)
moveq.l #15,d7
rts
*---------------------------------------------------------------------------------------*
file_error
bra global_exit
size_error
move.l #-35,d0
bra global_exit
buff_error
move.l #-8,d0
bra global_exit
no_pi
move.l #-31,d0
bra global_exit
no_support
move.l #-32,d0
.if KoPI
bra global_exit
.endif
global_exit
move.l stk(a6),sp
rts
*---------------------------------------------------------------------------------------*
.offset 0
color_tab: .ds.w 16*16
start_addr: .ds.l 1
ritu0: .ds.w 1
ritu1: .ds.w 1
xwid: .ds.w 1
ywid: .ds.w 1
addr: .ds.l 1
colum: .ds.w 1
line: .ds.w 1
opt: .ds.w 1
tone: .ds.w 1
stk: .ds.l 1
file: .ds.l 1
file_name: .ds.l 1
buff_size: .ds.l 1
buff_lest: .ds.l 1
buff_addr: .ds.l 1
buff_point: .ds.l 1
gbuff: .ds.l 1
palette: .ds.b 16*3
.even
size_of_data:
.text
data:
.ds.b size_of_data
_Pi_PaletteBuff equ data+palette
_ToneSet equ data+tone
rewrite_table
.dc.w pat1-data,1
.dc.w pat2-data,0
.dc.w pat3-data,-1
.dc.w pat4-data,1
.dc.w pat5-data,0
.dc.w pat7-data,-1
.dc.w pat8-data,1
.dc.w pat9-data,0
.dc.w pat10-data,0
.dc.w pat11-data,-1
.dc.w pat12-data,1
.dc.w pat13-data,1
.dc.w pat14-data,0
.dc.w pat16-data,-1
.dc.w pat17-data,-1
.dc.w 0
.end